
package combat.dudes.server.protocol.implementation;

import gnu.cajo.invoke.Remote;

import java.rmi.RemoteException;

import combat.dudes.protocol.data.DoublePoint;
import combat.dudes.protocol.interfaces.OrderInt;
import combat.dudes.protocol.types.OrderType;
import combat.dudes.server.ServerApp;


public class Order extends NewID.OrderID implements OrderInt {

	private static final long serialVersionUID = 1L;

	private int orderID = -1;
	private Object target = new DoublePoint(10, 10);
	private OrderType type = OrderType.UNKNOWN;

	public Order() {
		this.orderID = getID();
	}
	public Order(Object target, OrderType type) {
		this.orderID = getID();
		this.target = target;
		this.type = type;
	}

	@Override
	public int getOrderID() {
		return orderID;
	}
	@Override
	public void setOrderID(int orderID) {
		this.orderID = orderID;
	}

	@Override
	public Object getTarget() {
		return target;
	}
	@Override
	public void setTarget(Object target) {
		this.target = target;
	}

	@Override
	public OrderType getType() {
		return type;
	}
	@Override
	public void setType(OrderType type) {
		this.type = type;
	}


	@Override
	public Remote getTarget_Remote() {
		try {
			return new Remote(getTarget());
		} catch(RemoteException e) {
			ServerApp.onError("@Order.java, getTarget_Remote()", e, false);
		}
		return null;
	}

}
